import request from '@/router/axios';
import {downloadExcel} from '@/router/axios';
import {formatCondition} from '@/util/util';
//单条查询
export const queryGeneralNoteBook = (params) => {
  params.head.transCode = 'queryGeneralNoteBook';
  return request({
    url: '/general/generalNoteBook/queryGeneralNoteBook',
    method: 'post',
    data: params
  })
}
//多条列表查询，支持条件查询
export const queryGeneralNoteBookListPage = (params) => {
  params.head.transCode = 'queryGeneralNoteBookListPage';
  return request({
    url: '/general/generalNoteBook/queryGeneralNoteBookListPage',
    method: 'post',
    data: params
  })
}
//新增单条记录
export const saveGeneralNoteBook = (params) => {
  params.head.transCode = 'saveGeneralNoteBook';
  return request({
    url: '/general/generalNoteBook/saveGeneralNoteBook',
    method: 'post',
    data: params
  })
}
//新增多条记录
export const saveGeneralNoteBookList = (params) => {
  params.head.transCode = 'saveGeneralNoteBookList';
  return request({
    url: '/general/generalNoteBook/saveGeneralNoteBookList',
    method: 'post',
    data: params
  })
}
//新增或修改单条记录
export const saveOrUpdateGeneralNoteBook = (params) => {
  params.head.transCode = 'saveOrUpdateGeneralNoteBook';
  return request({
    url: '/general/generalNoteBook/saveOrUpdateGeneralNoteBook',
    method: 'post',
    data: params
  })
}


//新增或修改单条记录
export const saveOrUpdateGeneralNoteBookList = (params) => {
  params.head.transCode = 'saveOrUpdateGeneralNoteBookList';
  return request({
    url: '/general/generalNoteBook/saveOrUpdateGeneralNoteBookList',
    method: 'post',
    data: params
  })
}

//修改单条记录
export const updateGeneralNoteBook = (params) => {
  params.head.transCode = 'updateGeneralNoteBook';
  return request({
    url: '/general/generalNoteBook/updateGeneralNoteBook',
    method: 'post',
    data: params
  })
}

//删除单条记录
export const deleteGeneralNoteBook = (params) => {
  params.head.transCode = 'deleteGeneralNoteBook';
  return request({
    url: '/general/generalNoteBook/deleteGeneralNoteBook',
    method: 'post',
    data: params
  })
}

//删除多条记录
export const deleteGeneralNoteBookList = (params) => {
  params.head.transCode = 'deleteGeneralNoteBookList';
  return request({
    url: '/general/generalNoteBook/deleteGeneralNoteBookList',
    method: 'post',
    data: params
  })
}
//导出excel
export const exportGeneralNoteBookExcel = (params) => {
  downloadExcel({
    url: '/general/generalNoteBook/excelDownload/exportGeneralNoteBookExcel',
    method: 'get',
    data: 
    {
      tenantId: params.head.tenantId,
      orders:'',
      condition: formatCondition(params.body.sqlCondition)
    }
  })
}
